package com.example.zhangxun0527.fragment;

import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.zhangxun0527.MainActivity;
import com.example.zhangxun0527.MyShopDemo.User;
import com.example.zhangxun0527.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class ShouyeFragment extends Fragment {

    public ShouyeFragment() {
        // Required empty public constructor
    }
    public static ShouyeFragment getInstance(String title) {
        ShouyeFragment shouyeFragment = new ShouyeFragment();
        Bundle bundle = new Bundle();
        bundle.putString("title", title);
        shouyeFragment.setArguments(bundle);
        return shouyeFragment;
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_shouye, container, false);
        TextView tv=view.findViewById(R.id.tv_content);
        Bundle bundle =getArguments();
        MainActivity activity = (MainActivity) getActivity();
        User user = activity.message();
        tv.setText(bundle.getString("user"));
        tv.setText("用户名："+user.getUsername()+"密码："+user.getPassword()+"性别："+user.getSex()+"手机号："+user.getPassword()+"爱好："+user.getHobby());
        return view;
    }
}
